<?php
class Admin_PayhelpController extends Zend_Controller_Action
{	
    public function init() {
        if (Zend_Auth::getInstance ( 'admin' )->setStorage ( new Zend_Auth_Storage_Session ( 'admin' ) )->hasIdentity () == false) {
			$this->_helper->getHelper ( 'Redirector' )->gotoUrl ( "admin/login" );
		} 
    }

    public function indexAction() {
        try {
           $abouts = new Vina_Model_Abouts();
           $form                   = new Admin_Form_About();
           $form->removeElement('image');
		   
           $id                     =  3;
           $data = $abouts->find($id)->toArray();
           
           $form->populate($data);
            if ($this->_request->isPost()) {
                
                $formData = $this->_request->getPost();

                if ($form->isValid($formData)) {
                   $dataInsert = $form->getValues();
                   $abouts->setId($id);
				   if($dataInsert['image'] != NULL) {
                   $news->setImage("upload/".$dataInsert['image']);
                   }
                   $abouts->setDescription($formData['description']);
                   $abouts->setContent($formData['content']);
                   $abouts->save();
                   $this->_redirect('/admin/payhelp');
                }
            }
           //set view
           $this->view->form       = $form;
        }catch(Exception $ex){
            echo "<pre>";
            print_r($ex->getMessage());
        }
    }
 	
}
